<?php
namespace app\web\validate;

use think\Validate;

/**
 * 行为验证器
 * @package app\menus\validate
 * @author
 */
class Attendance extends Validate
{
    //定义验证规则
    protected $rule = [
        'id|考勤ID' =>'require',
        'group|部门'  => 'require',
        'engineer_id|请假人'  => 'require',
        'reason|原因'  => 'require',
        'rank|排位设置' =>'require',
        'start_time|开始时间' =>'require',
        'end_time|结束时间' =>'require',
        'day|实算天数' =>'require',
    ];
    //定义验证提示
    protected $message = [
        'id.require' => '考勤ID必须填写',
        'group.require' => '部门必须选择',
        'engineer_id.require' => '请假人填写',
        'reason.require' => '原因必须填写',
        'rank.require' => '排位设置必须填写',
        'start_time.require' => '开始时间不能为空',
        'end_time.require' => '结束时间不能为空',
        'day.require' => '实际天数不能为空',
    ];
    //定义验证场景
    protected $scene = [
        'add'   =>  ['group','engineer_id','reason','rank','start_time','end_time','day'],
        'edit'   =>  ['id','group','engineer_id','reason','rank','start_time','end_time','day'],
    ];
}
